"""
数据源加载
"""
import pandas as pd


def load_csv(file, index_name):
    """
    :param file: csv文件
    :param index_name: index
    :return:
    """
    df = pd.read_csv(file)

    df = df.set_index(index_name)
    return df


def load_excel(file, sheet_name, index_name):
    """
    :param file: excel文件
    :param sheet_name: 第几个sheet页
    :param index_name: index
    :return:
    """
    df = pd.read_excel(file, sheet_name=sheet_name)

    df = df.set_index(index_name)
    df = df.sort_index()
    return df
